package com.moetube.video.dao;


import com.moetube.video.pojo.Comment;
import feign.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;


public interface CommentMapper extends Mapper<Comment> {

    @Select("select * from comment where video_id=#{videoId}")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "video_id",property = "videoId"),
            @Result(column = "content",property = "content"),
            @Result(column = "user_id",property = "userId"),
            @Result(column = "parent_id",property = "parentId"),
            @Result(column = "comment_time",property = "commentTime"),
            @Result(column = "client_from",property = "clientFrom"),
            @Result(column = "like_count",property = "likeCount"),
            @Result(column = "unlike_count",property = "unlikeCount")
    })
    List<Comment> findListByVideoId(@Param("videoId") String videoId);

    @Select("select count(id) from commment where video_id=#{videoId}")
    int findCommentTotal(Long videoId);
}
